#include <sys/mman.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#define MEM_SEGMENT_SIZE 100000

#define MEM_SEGMENT_HEADER_SIZE 2*sizeof(void*)+sizeof(size_t)
#define SIZE sizeof(void*)
#define NEXT sizeof(void*)+sizeof(size_t)

#define SEGMENT_HEADER_SIZE 2*sizeof(void*)+sizeof(size_t)+sizeof(char)
#define FREE sizeof(size_t)
#define NEXT_FREE sizeof(size_t)+sizeof(char)
#define PREV_FREE sizeof(size_t)+sizeof(char)+sizeof(void*)

#define SEGMENT_FOOTER_SIZE sizeof(size_t)

void* myMalloc (size_t);
void myFree (void*);
void freeAll();